#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ----------------------------------------------------------
# -- 
# --
# ****************************
# Author: lmay.Zhou
# Blog: www.lmaye.com
# Date: 2021/9/7 11:51
# Email lmay@lmaye.com
# ----------------------------------------------------------
import os
from scrapy import cmdline
from scrapy.utils.project import get_project_settings

if __name__ == "__main__":
    # cmdline.execute("scrapy crawl amazon-ca".split())
    # cmdline.execute("scrapy crawl amazon-com".split())
    # cmdline.execute("scrapy crawl amazon-de".split())
    # cmdline.execute("scrapy crawl amazon-jp".split())
    # cmdline.execute("scrapy crawl amazon-uk".split())

    # 多个爬虫, 同时执行。
    crawler = cmdline.CrawlerProcess(get_project_settings())
    crawler.crawl("amazon-ca")
    crawler.crawl("amazon-com")
    crawler.crawl("amazon-de")
    crawler.crawl("amazon-jp")
    crawler.crawl("amazon-uk")

    crawler.start()
    crawler.start()
    crawler.start()
    crawler.start()
    crawler.start()
    # 关闭窗口
    os.system('taskkill /im chromedriver.exe /F')
